
import socket

server = socket.socket()
server.bind(("127.0.0.1", 8989))
server.listen(5)
while True:
    print("等待连接----")
    conn, addr = server.accept()
    print("连接成功", conn, addr)
    while True:
        data = conn.recv(1024)
        serData = str(data)
        print(serData)
        conn.send(serData.upper().encode('utf-8'))